<div class="detail">
	<?php
		require_once('lib/sql.utils.php');
		require_once('lib/same_book.php');
		$sql_utils = new SqlUtils();
		$authorId = $_GET['authorId'];
		$result = $sql_utils->getRows('SELECT * FROM authors
										JOIN books where authors.authorId = books.authorId');
		echo '<div class="name">'.$result[0]['authorName'].'</div>';
		echo '<div class="image">';
			echo '<img src="images/author/'.$result[0]['authorImage'].'" />';
		echo '</div>';
		echo '<div class="info">';
		echo 'Các sách đã xuất bản : ';
		for ($i=0; $i < count($result); $i++) {
			echo '<a onclick="getBook('.$result[$i]['bookId'].')">'.$result[$i]['bookName'].'</a>';
			if($i != count($result)-1) echo ',&nbsp&nbsp';
			else echo '.';
		}
		echo '<br />';
		echo 'Email liên lạc : '.'<a href="mailto:'.$result[0]['authorEmail'].'">'.$result[0]['authorEmail'].'</a>';
		echo '</div>';
		echo '<div class="description">';
			echo $result[0]['authorDescription'];
		echo '</div>';
		echo '<button class="back-btn" onclick="prevContent()"></button>';
		
		$sameBook = new sameBook('SELECT * FROM books WHERE authorId = '.$authorId,
									'Các sách cùng tác giả :','same-book');
		$sameBook->display();
	?>
</div>